﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RecipeRecommender
{
    //enum Ingredient {
    //VEGETABLE,SPINACH, BROCOLLI, CABBAGE, POTATO, TURNIP, 
    //    BEANS, RED_BEAN, EGG, FLOUR, 
    //    MEAT,CHICKEN,DUCK,PORK,BEEF,VENISON,
    //};
    enum Cuisine{
        NONE=0, WESTERN = 1, CHINESE, VIETNAMESE, INDONESIAN, INDIAN
    }
    


    enum MealType{
        NONE=0, STARTER = 1, DESSERT, MAIN
    }
    enum CookingMethod
    {
        NONE=0, SOUP=1,STEAMED,GRILLED,MIXED,FRIED
    }

    enum Spicy
    {
        NONE = 0, SPICY = 1, NON_SPICY = 2 
    }

    enum Halal
    {
        NONE=0, HALAL=1, NON_HALAL = 2
    }


    enum Vegetarian
    {
        NONE=0, VEGETARIAN=1, NON_VEGETARIAN=2
    }
    enum Healthy
    {
        NONE=0, HEALTHY=1, NOT_HEALTHY=2
    }
    class CRecipe
    {

        private String strName;
        private double dSimilarity;

        private String[] cCuisineStrings;
        private String[] cMealTypeStrings;
        private String[] cCookingMethodStrings;
        private String[] cSpicyStrings;
        private String[] cVegetarianStrings;
        private String[] cHalalStrings;
        private String[] cHealthyStrings;

        public CRecipe()
        {
            cCuisineStrings = new String[]
            {
                "none", "western","chinese","vietnamese","indonesian","indian"
            };

            cMealTypeStrings = new String[]
            {
                "none","starter","desert","main"
            };

            cCookingMethodStrings = new String[]
            {
                "none","soup", "steamed","grilled","mixed","fried"
            };

            cSpicyStrings = new String[]
            {
                "none","spicy","nonspicy"
            };
            cVegetarianStrings = new String[]
            {
                "none","vegetarian","nonvegetarian"
            };

            cHalalStrings = new String[]
            {
                "none","halal","nonhalal"
            };

            cHealthyStrings = new String[]
            {
                "none","healthy","nonhealthy"
            };

            dSimilarity = 0;
        }

        public double Similarity
        {
            get { return dSimilarity; }
            set { dSimilarity = value; }
        }

        public String name
        {
            get { return strName; }
            set { strName = value; }
        }
        private int nCuisine;

        public int cuisine
        {
            get { return nCuisine; }
            set { nCuisine = value; }
        }

        public void setCuisine(String strCuisine)
        {
            String strValue = strCuisine;
                
                for (int i = 0; i < cCuisineStrings.Length; i++)
                {
                    if (cCuisineStrings[i].ToLower() == strValue.ToLower())
                    {
                        nCuisine = i;
                    }
                }
           
        }

        public String getCuisine()
        {
            return cCuisineStrings[nCuisine];
        }
        private int nMealType;

        public int mealType
        {
            get { return nMealType; }
            set { nMealType = value; }
        }

        public void setMealType (String strMealType)
        {
            String strValue = strMealType;
            

            for (int i = 0; i < cMealTypeStrings.Length; i++)
            {
                if (cMealTypeStrings[i].ToLower() == strValue.ToLower())
                {
                    nMealType = i;
                }
            }
        }

        private List<CIngredient> cIngredients;

        public List<CIngredient> ingredients
        {
            get { return cIngredients; }
            set { cIngredients = value; }
        }

        private int nCookingMethod;

        public int cookingMethod
    {
        get {return nCookingMethod;}
        set { nCookingMethod = value;}
    }

        public void setCookingMethod(String strCookingMethod)
        {
            String strValue = strCookingMethod;
            

            for (int i = 0; i < cCookingMethodStrings.Length; i++)
            {
                if (cCookingMethodStrings[i].ToLower() == strValue.ToLower())
                {
                    nCookingMethod = i;
                }
            }
        }

        private int nSpicy;

        public int spicy
        {
            get { return nSpicy; }
            set { nSpicy = value; }
        }

        public void setSpicy(String strSpicy)
        {
            String strValue = strSpicy;
            

            if (strValue.ToLower() == cSpicyStrings[(int)Spicy.SPICY].ToLower())
            {
                nSpicy = (int)Spicy.SPICY;
            }
            if (strValue.ToLower() == cSpicyStrings[(int)Spicy.NON_SPICY].ToLower())
            {
                nSpicy = (int)Spicy.NON_SPICY;
            }


        }

        private int nHalal;
        
            public int halal
            {
                get { return nHalal; }
                set { nHalal = value; }
            }

            public void setHalal(String strHalal)
            {
                String strValue = strHalal;
                

                if (strValue.ToLower() == cHalalStrings[(int)Halal.HALAL].ToLower())
                {
                    nHalal = (int)Halal.HALAL;
                }
                if (strValue.ToLower() == cHalalStrings[(int)Halal.NON_HALAL].ToLower())
                {
                    nHalal = (int)Halal.NON_HALAL;
                }

            }

            private int nHealthy;
            public int healthy
            {
                get { return nHealthy; }
                set { nHealthy = value; }
            }

        public void setHealthy (String strHealthy)
        {
                String strValue = strHealthy;
                

                if (strValue.ToLower() == cHealthyStrings[(int)Healthy.HEALTHY].ToLower())
                {
                    nHealthy = (int)Healthy.HEALTHY;
                }
                if (strValue.ToLower() == cHealthyStrings[(int)Healthy.NOT_HEALTHY].ToLower())
                {
                    nHealthy = (int)Healthy.NOT_HEALTHY;
                }
        }

            private int nVegetarian;
            public int vegetarian
            {
                get { return nVegetarian; }
                set { nVegetarian = value; }
            }

            public void setVegetarian(String strVeg)
            {
                String strValue = strVeg;
                

                if (strValue.ToLower() == cVegetarianStrings[(int)Vegetarian.VEGETARIAN].ToLower())
                {
                    nVegetarian = (int)Vegetarian.VEGETARIAN;
                }
                if (strValue.ToLower() == cHealthyStrings[(int)Vegetarian.NON_VEGETARIAN].ToLower())
                {
                    nVegetarian = (int)Vegetarian.NON_VEGETARIAN;
                }               
            }

            private double dCookingTime; //in minutes

            public double cookingTime
            {
                get { return dCookingTime; }
                set { dCookingTime = value; }
            }
        private int nServings;
        public int servings
        {
            get { return nServings; }
            set { nServings = value; }
        }


        private List<CIngredient> cExcludedIngredients;

        public List<CIngredient> excludedIngredients
        {
            get { return cExcludedIngredients; }
            set { cExcludedIngredients = value; }
        }

        private String strWebLink;
        public String webLink
        {
            get { return strWebLink; }
            set { strWebLink = value; }
        }

        public String getRecipeString()
        {
            String strRecipe;

            strRecipe = "Name: " + strName + "\n"
                + "Cuisine: " + cCuisineStrings[nCuisine] + "\n"
                + "Ingredients: ";
            foreach (CIngredient cIng in cIngredients)
            {
                strRecipe += cIng.getString() + ", ";
            }

            strRecipe += "\n";

            strRecipe += "Similarity: ";
            strRecipe += dSimilarity;
            strRecipe += "\n\n";
            return strRecipe;
        }

    }
}
